﻿namespace Framework
{
    public class Singleton<T> : IDisposable where T : new()
    {
        private static T _instance;
        public static T instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new T();
                }
                return _instance;
            }
        }

        public virtual void Dispose()
        {
            _instance = default(T);
        }
    }
}